class Greeter {
    element: HTMLElement;
    span: HTMLElement;
    timerToken: number;

    constructor(element: HTMLElement) {
        this.element = element;
        this.element.innerHTML += "The time is: ";
        this.span = document.createElement('span');
        this.element.appendChild(this.span);
        this.span.innerText = new Date().toUTCString();
        //this.gameStart();
    }

    start() {
        this.timerToken = setInterval(() => this.span.innerHTML = new Date().toUTCString(), 500);
    }

    stop() {
        clearTimeout(this.timerToken);
    }
    gameStart(){
        var renderer = PIXI.autoDetectRenderer(256,256);
        document.body.appendChild(renderer.view);
        var stage = new PIXI.Container();
        renderer.render(stage);
        PIXI.loader.add("images/head.png").load(setup);
        function setup(){
            var sprite = new PIXI.Sprite(
                PIXI.loader.resources["images/head.png"].texture
            );
            stage.addChild(sprite);
            renderer.render(stage);
        }
    }
    
}

window.onload = () => {
    var el = document.getElementById('content');
    var greeter = new Greeter(el);
    greeter.start(); 
    var game:Game = new Game();
    game.start();
};